﻿using System;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdEdCommand : OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdEdCommand(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdEdCommand_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdEdCommand obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdEdCommand()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdEdCommand(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdEdCommand() : this(GlobalsPINVOKE.new_OdEdCommand(), MemoryManager.GetMemoryManager().GetCurrentTransaction() == null)
		{
			MemoryTransaction currentTransaction = MemoryManager.GetMemoryManager().GetCurrentTransaction();
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(new OdEdCommand(this.swigCPtr.Handle, true));
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			this.SwigDirectorConnect();
		}

		public new static OdEdCommand cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdCommand_cast(OdRxObject.getCPtr(pObj));
			OdEdCommand result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdEdCommand_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(this.SwigDerivedClassHasMethod("isA", OdEdCommand.swigMethodTypes1) ? GlobalsPINVOKE.OdEdCommand_isASwigExplicitOdEdCommand(this.swigCPtr) : GlobalsPINVOKE.OdEdCommand_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(this.SwigDerivedClassHasMethod("queryX", OdEdCommand.swigMethodTypes0) ? GlobalsPINVOKE.OdEdCommand_queryXSwigExplicitOdEdCommand(this.swigCPtr, OdRxClass.getCPtr(protocolClass)) : GlobalsPINVOKE.OdEdCommand_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdEdCommand createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdCommand_createObject__SWIG_0();
			OdEdCommand result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdEdCommand createObject(string sGroupName, string sGlobalName, string sLocalName, uint commandFlags, OdEdCommandFunctionDelegate pFunction, OdRxModule pModule)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdCommand_createObject__SWIG_1(sGroupName, sGlobalName, sLocalName, commandFlags, pFunction, OdRxModule.getCPtr(pModule));
			OdEdCommand result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdEdCommand createObject(string sGroupName, string sGlobalName, string sLocalName, uint commandFlags, OdEdCommandFunctionDelegate pFunction)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdCommand_createObject__SWIG_2(sGroupName, sGlobalName, sLocalName, commandFlags, pFunction);
			OdEdCommand result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual string groupName()
		{
			string result = GlobalsPINVOKE.OdEdCommand_groupName(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual string globalName()
		{
			string result = GlobalsPINVOKE.OdEdCommand_globalName(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual string localName()
		{
			string result = this.SwigDerivedClassHasMethod("localName", OdEdCommand.swigMethodTypes4) ? GlobalsPINVOKE.OdEdCommand_localNameSwigExplicitOdEdCommand(this.swigCPtr) : GlobalsPINVOKE.OdEdCommand_localName(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void execute(OdEdCommandContext pCommandContext)
		{
			GlobalsPINVOKE.OdEdCommand_execute(this.swigCPtr, OdEdCommandContext.getCPtr(pCommandContext));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdRxModule module()
		{
			OdRxModule result = (OdRxModule)Teigha.Core.Helpers.odrxCreateObjectInternal(this.SwigDerivedClassHasMethod("module", OdEdCommand.swigMethodTypes6) ? GlobalsPINVOKE.OdEdCommand_moduleSwigExplicitOdEdCommand(this.swigCPtr) : GlobalsPINVOKE.OdEdCommand_module(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void undefine(bool undefIt)
		{
			if (this.SwigDerivedClassHasMethod("undefine", OdEdCommand.swigMethodTypes7))
			{
				GlobalsPINVOKE.OdEdCommand_undefineSwigExplicitOdEdCommand(this.swigCPtr, undefIt);
			}
			else
			{
				GlobalsPINVOKE.OdEdCommand_undefine(this.swigCPtr, undefIt);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual int flags()
		{
			int result = this.SwigDerivedClassHasMethod("flags", OdEdCommand.swigMethodTypes8) ? GlobalsPINVOKE.OdEdCommand_flagsSwigExplicitOdEdCommand(this.swigCPtr) : GlobalsPINVOKE.OdEdCommand_flags(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private void SwigDirectorConnect()
		{
			if (this.SwigDerivedClassHasMethod("queryX", OdEdCommand.swigMethodTypes0))
			{
				this.swigDelegate0 = new OdEdCommand.SwigDelegateOdEdCommand_0(this.SwigDirectorqueryX);
			}
			if (this.SwigDerivedClassHasMethod("isA", OdEdCommand.swigMethodTypes1))
			{
				this.swigDelegate1 = new OdEdCommand.SwigDelegateOdEdCommand_1(this.SwigDirectorisA);
			}
			if (this.SwigDerivedClassHasMethod("groupName", OdEdCommand.swigMethodTypes2))
			{
				this.swigDelegate2 = new OdEdCommand.SwigDelegateOdEdCommand_2(this.SwigDirectorgroupName);
			}
			if (this.SwigDerivedClassHasMethod("globalName", OdEdCommand.swigMethodTypes3))
			{
				this.swigDelegate3 = new OdEdCommand.SwigDelegateOdEdCommand_3(this.SwigDirectorglobalName);
			}
			if (this.SwigDerivedClassHasMethod("localName", OdEdCommand.swigMethodTypes4))
			{
				this.swigDelegate4 = new OdEdCommand.SwigDelegateOdEdCommand_4(this.SwigDirectorlocalName);
			}
			if (this.SwigDerivedClassHasMethod("execute", OdEdCommand.swigMethodTypes5))
			{
				this.swigDelegate5 = new OdEdCommand.SwigDelegateOdEdCommand_5(this.SwigDirectorexecute);
			}
			if (this.SwigDerivedClassHasMethod("module", OdEdCommand.swigMethodTypes6))
			{
				this.swigDelegate6 = new OdEdCommand.SwigDelegateOdEdCommand_6(this.SwigDirectormodule);
			}
			if (this.SwigDerivedClassHasMethod("undefine", OdEdCommand.swigMethodTypes7))
			{
				this.swigDelegate7 = new OdEdCommand.SwigDelegateOdEdCommand_7(this.SwigDirectorundefine);
			}
			if (this.SwigDerivedClassHasMethod("flags", OdEdCommand.swigMethodTypes8))
			{
				this.swigDelegate8 = new OdEdCommand.SwigDelegateOdEdCommand_8(this.SwigDirectorflags);
			}
			GlobalsPINVOKE.OdEdCommand_director_connect(this.swigCPtr, this.swigDelegate0, this.swigDelegate1, this.swigDelegate2, this.swigDelegate3, this.swigDelegate4, this.swigDelegate5, this.swigDelegate6, this.swigDelegate7, this.swigDelegate8);
		}

		private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes)
		{
			MethodInfo method = base.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, methodTypes, null);
			return method.DeclaringType.IsSubclassOf(typeof(OdEdCommand));
		}

		private IntPtr SwigDirectorqueryX(IntPtr protocolClass)
		{
			return OdRxObject.getCPtr(this.queryX((OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(protocolClass, false))).Handle;
		}

		private IntPtr SwigDirectorisA()
		{
			return OdRxClass.getCPtr(this.isA()).Handle;
		}

		[return: MarshalAs(UnmanagedType.LPWStr)]
		private string SwigDirectorgroupName()
		{
			return this.groupName();
		}

		[return: MarshalAs(UnmanagedType.LPWStr)]
		private string SwigDirectorglobalName()
		{
			return this.globalName();
		}

		[return: MarshalAs(UnmanagedType.LPWStr)]
		private string SwigDirectorlocalName()
		{
			return this.localName();
		}

		private void SwigDirectorexecute(IntPtr pCommandContext)
		{
			this.execute((OdEdCommandContext)Teigha.Core.Helpers.odrxCreateObjectInternal(pCommandContext, false));
		}

		private IntPtr SwigDirectormodule()
		{
			return OdRxModule.getCPtr(this.module()).Handle;
		}

		private void SwigDirectorundefine(bool undefIt)
		{
			this.undefine(undefIt);
		}

		private int SwigDirectorflags()
		{
			return this.flags();
		}

		public const int kModal = 0;

		public const int kTransparent = 1;

		public const int kUsePickset = 2;

		public const int kRedraw = 4;

		public const int kNoPerspective = 8;

		public const int kNoMultiple = 16;

		public const int kNoTilemode = 32;

		public const int kNoPaperspace = 64;

		public const int kPlotOnly = 128;

		public const int kNoOEM = 256;

		public const int kUndefined = 512;

		public const int kInProgress = 1024;

		public const int kDefun = 2048;

		public const int kNoNewStack = 65536;

		public const int kNoInternalLock = 131072;

		public const int kDocReadLock = 524288;

		public const int kDocExclusiveLock = 1048576;

		public const int kSession = 2097152;

		public const int kInterruptible = 4194304;

		public const int kNoHistory = 8388608;

		public const int kNoUndoMarker = 16777216;

		public const int kNoBedit = 33554432;

		private object locker = new object();

		private HandleRef swigCPtr;

		private OdEdCommand.SwigDelegateOdEdCommand_0 swigDelegate0;

		private OdEdCommand.SwigDelegateOdEdCommand_1 swigDelegate1;

		private OdEdCommand.SwigDelegateOdEdCommand_2 swigDelegate2;

		private OdEdCommand.SwigDelegateOdEdCommand_3 swigDelegate3;

		private OdEdCommand.SwigDelegateOdEdCommand_4 swigDelegate4;

		private OdEdCommand.SwigDelegateOdEdCommand_5 swigDelegate5;

		private OdEdCommand.SwigDelegateOdEdCommand_6 swigDelegate6;

		private OdEdCommand.SwigDelegateOdEdCommand_7 swigDelegate7;

		private OdEdCommand.SwigDelegateOdEdCommand_8 swigDelegate8;

		private static Type[] swigMethodTypes0 = new Type[]
		{
			typeof(OdRxClass)
		};

		private static Type[] swigMethodTypes1 = new Type[0];

		private static Type[] swigMethodTypes2 = new Type[0];

		private static Type[] swigMethodTypes3 = new Type[0];

		private static Type[] swigMethodTypes4 = new Type[0];

		private static Type[] swigMethodTypes5 = new Type[]
		{
			typeof(OdEdCommandContext)
		};

		private static Type[] swigMethodTypes6 = new Type[0];

		private static Type[] swigMethodTypes7 = new Type[]
		{
			typeof(bool)
		};

		private static Type[] swigMethodTypes8 = new Type[0];

		public delegate IntPtr SwigDelegateOdEdCommand_0(IntPtr protocolClass);

		public delegate IntPtr SwigDelegateOdEdCommand_1();

		[return: MarshalAs(UnmanagedType.LPWStr)]
		public delegate string SwigDelegateOdEdCommand_2();

		[return: MarshalAs(UnmanagedType.LPWStr)]
		public delegate string SwigDelegateOdEdCommand_3();

		[return: MarshalAs(UnmanagedType.LPWStr)]
		public delegate string SwigDelegateOdEdCommand_4();

		public delegate void SwigDelegateOdEdCommand_5(IntPtr pCommandContext);

		public delegate IntPtr SwigDelegateOdEdCommand_6();

		public delegate void SwigDelegateOdEdCommand_7(bool undefIt);

		public delegate int SwigDelegateOdEdCommand_8();
	}
}
